//package com.fatmeraid.common.utils;
//
//import com.alibaba.fastjson.JSONObject;
//import com.alipay.api.AlipayApiException;
//import com.alipay.api.AlipayClient;
//import com.alipay.api.DefaultAlipayClient;
//import com.alipay.api.request.AlipayTradePagePayRequest;
//import com.alipay.api.request.AlipayTradeQueryRequest;
//import com.alipay.api.response.AlipayTradeQueryResponse;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.stereotype.Component;
//@Component
//public class PayUtil {
//	@Autowired
//	private OrderService orderService;
//	//appid
//	private final String APP_ID = "9021000151646216";
//	//应用私钥
//	private final String APP_PRIVATE_KEY = "MIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQCUfMAkBRAShXO6MyprO8eb1/dzbWueZivdq2VwTH+eTIOLV/us5bia4Lga5lbclBvxf503mSGuQ8Bsuxy76BzeTwahjjHMjbIUeP8N01Y2WkxQrtmX6b1On4D660fViwO23CK0b6oFNylxy5SKRdxHAvNeUUhbBq/s1jdb53bVscddneNu0ArXLVCcSp0H3GKX4Sx9kVC7YhV4AWid2vUNbD9P41sc6N2zJM73+402pvQrXO2z+d5hgtPETcfAzsg7m0XLpvUYJj7rjSblfRAHgsmuZZqfXbS4cM+WuV9XR3EnIuJ4fNpv8dA+IFDV6qcAUauazAObFlbOZDtKjxKzAgMBAAECggEADgEaCgukMWr+uC/9LzHrKIqc3vkR7lWKi5SPs6CzZJWozmqU5QChgZHyKy9QP+uEGynDBSxfHdVr/5VCJ4LDvj/Ly07i6Xzvr7idrYsiFWw8yFtFUGuOHC009/VayAwdZJCsgUIK0gUa1o2xy7y9AsGHfHzECzm9O+QUQom5DnxaDdeWWy5XB5PhlgkqQ+Rbom2cigOBFrFoq/CWFY+DcXA/uB4Vbv6D1yCM7L97zsUFtqG/ZAPMGHTPVT6UZVvoJNY9BYNks7QMHjTMRhuefhSECN0fmdyScfl+IILZbpUERoYdp14VGrDWClPDtU+eHySSCpI/qFv4TQhIY3lvKQKBgQDPPa8RChF1gjXHxpHeP8peZA7jjpmC5Q3SQwrd1SFNa+DQC3M942nAN7pZ+s7/2dYstdd1yZR4RBelb62RVaerFK5l2yeBFvz/o2ZRuUF557VAJNzqBYhTUcHPmbSGKXo4Wl/VLP8dWFTcxeHIzD5zE5gBBdwfuI9mWxNB7YUfTwKBgQC3bEecufPLt1Yqh/3mSozhLBuNqQMwhr76y4ukqe1tHEbXVW1bmIKEqtKJT/3aGSWU5ya0b6CpkrdbJEunSHlZArX2G6Mv87X9isunSU/lvZos1GjnUE+Mc9DANKSuC7JZFTnUSOSO4UawqCwOzm64wn4PLav/cY5oj3SzIT1dXQKBgC9njbcZFXtKqKCk9FLhRpomyx0UTlsZp/qzqTWq/e4mwgr0w4yhi1wTo0XX0CfIHWymv71KufJ0qPAHxq0a6bqBhY74/WVS69ZR+yKwfKC09snQZNQHJfLhHbMuFpQlwrZHPeqWW1jMDsVdYlM7HQHXtoptW7fJ0Mt6A8Kt4SiTAoGALC5uyXeZG9bbcH81T0VhzdM8B9FQLV4nnm1tA4rS39dR0QiIwOlpdt9WuzCDawdnoAhVsFy7DF2EwPVrK64vXJtkjRV3J1PC4IGQMIleL26ONoIripwzrRcwjzue9zVmDkMonNO6ChiFWIQJqL9cuDBRAQL1TSBjNxhm+cbl6xkCgYEAtUo6ynDUFMs2Rqu+OCMovoaGISrogzygV5uw92/K74uia7of6YgvJgrDB8F4cWAUdr+D0IMBPBuDUkgiWNbBKDnozZ1oAhCQE289e9gbL/ghpuLOuyFD9BGO/PsK4tvOGcQjLVWJU+nq+95ruZITdGA4d6L8VLrUMD1hd+rksJ4=";
//
//	private final String CHARSET = "UTF-8";
//	// 支付宝公钥
//	private final String ALIPAY_PUBLIC_KEY = "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAlHzAJAUQEoVzujMqazvHm9f3c21rnmYr3atlcEx/nkyDi1f7rOW4muC4GuZW3JQb8X+dN5khrkPAbLscu+gc3k8GoY4xzI2yFHj/DdNWNlpMUK7Zl+m9Tp+A+utH1YsDttwitG+qBTcpccuUikXcRwLzXlFIWwav7NY3W+d21bHHXZ3jbtAK1y1QnEqdB9xil+EsfZFQu2IVeAFondr1DWw/T+NbHOjdsyTO9/uNNqb0K1zts/neYYLTxE3HwM7IO5tFy6b1GCY+640m5X0QB4LJrmWan120uHDPlrlfV0dxJyLieHzab/HQPiBQ1eqnAFGrmswDmxZWzmQ7So8SswIDAQAB";
//	//这是沙箱接口路径,正式路径为https://openapi.alipay.com/gateway.do
//	private final String GATEWAY_URL = "https://openapi-sandbox.dl.alipaydev.com/gateway.do";
//	private final String FORMAT = "JSON";
//	//签名方式
//	private final String SIGN_TYPE = "RSA2";
//	//支付宝异步通知路径,付款完毕后会异步调用本项目的方法,必须为公网地址
//	private final String NOTIFY_URL = "https://frp-oil.com:21711/api/alipay/toSuccess";
//	//支付宝同步通知路径,也就是当付款完毕后跳转本项目的页面,可以不是公网地址
//	private final String RETURN_URL = "http://localhost:80/api/alipay/toSuccess";
//	private AlipayClient alipayClient = null;
//	//支付宝官方提供的接口a
//	public String sendRequestToAlipay(String outTradeNo, Float totalAmount, String subject) throws AlipayApiException {
//		//获得初始化的AlipayClient
//		alipayClient = new DefaultAlipayClient(GATEWAY_URL, APP_ID, APP_PRIVATE_KEY, FORMAT, CHARSET, ALIPAY_PUBLIC_KEY, SIGN_TYPE);
//
//		//设置请求参数
//		AlipayTradePagePayRequest alipayRequest = new AlipayTradePagePayRequest();
//		alipayRequest.setReturnUrl(RETURN_URL);
//		alipayRequest.setNotifyUrl(NOTIFY_URL);
//
//		//商品描述（可空）
//		String body = "";
//		alipayRequest.setBizContent("{\"out_trade_nos\":\"" + outTradeNo + "\","
//				+ "\"total_amount\":\"" + totalAmount + "\","
//				+ "\"subject\":\"" + subject + "\","
//				+ "\"body\":\"" + body + "\","
//				+ "\"product_code\":\"FAST_INSTANT_TRADE_PAY\"}");
//
//		//请求
//		String result = alipayClient.pageExecute(alipayRequest).getBody();
//		System.out.println("返回的结果是："+result );
//		return result;
//	}
//
//	//    通过订单编号查询
//	public String query(String id){
//		AlipayTradeQueryRequest request = new AlipayTradeQueryRequest();
//		JSONObject bizContent = new JSONObject();
//		bizContent.put("out_trade_no", id);
//		request.setBizContent(bizContent.toString());
//		AlipayTradeQueryResponse response = null;
//		String body=null;
//		try {
//			response = alipayClient.execute(request);
//			body = response.getBody();
//		} catch (AlipayApiException e) {
//			e.printStackTrace();
//		}
//		if(response.isSuccess()){
//			System.out.println("调用成功");
//		} else {
//			System.out.println("调用失败");
//		}
//		return body;
//	}
//}
